package com.coocaa.aries.jmeter.enums;

/**
 * @author : bijiahao
 * @date : 2019/4/10.
 * @description:<p> </p>
 */
public enum ExecStatusEnums {

    INIT(1, "初始状态"),
    EXECUING(2, "正在执行"),
    OK(3, "执行成功"),
    ERROR(4, "执行异常"),
    QUEUING(5, "排队中");

    private final int code;

    private final String desc;

    ExecStatusEnums(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 正在执行状态
     *
     * @param status
     * @return
     */
    public static boolean isExecuting(Integer status) {
        return null != status && status == EXECUING.getCode();
    }

    public static boolean isCanRemove(Integer status) {
        return null != status &&
                (status == INIT.getCode()
                        || status == ERROR.getCode()
                );
    }

    /**
     * 排队状态
     *
     * @param status
     * @return
     */
    public static boolean isQueuing(Integer status) {
        return null != status && status == QUEUING.getCode();
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
